M.define(function (motorMongoFactory) {
    motorMongoFactory.act("create");

    var helloCollection;

    var timestamp = 0;
    return {
        __init__: function (node) {

            helloCollection = motorMongoFactory.create({
                host:"localhost:27017",
                dbName:"test",
                collName:"hello"
            });
        },
        save : function (entity) {
            var res = helloCollection.save(entity);
            if(timestamp == 0){
                timestamp = new Date().getTime();
            }
            return res;
        },
        findByReadableId: function (readableId) {
            var list = helloCollection.find({
                readableId : readableId
            },{
                page:0,
                limit : 1
            })
            if(list.length >0){
                return list[0];
            }
        },
        showTime: function () {
            print("===>"+(new Date().getTime() - timestamp));
        }
    }
})